package com.timothy.junk.tfund.activity;

import java.util.ArrayList;
import java.util.List;
import com.timothy.junk.R;
import com.timothy.junk.ActivityManage;
import com.timothy.junk.adapter.TFundNotifyAdaptor;
import com.timothy.junk.common.parse.TFundParse;
import com.timothy.junk.tfund.bean.TFund;
import com.timothy.junk.tfund.bean.TFundNotify;
import android.app.ListActivity;
import android.content.Context;
import android.content.SharedPreferences;
import android.os.Bundle;

public class TFundNotifyList extends ListActivity {
	public static final String LOG_TAG = "CBondList";

    Context mContext;
    SharedPreferences sp;
    TFundNotifyAdaptor adaptor ;
    
    List<TFund> tFundList;
    List<TFundNotify> tFundNotifyList = new ArrayList<TFundNotify>();;
    
    public void loadData(){
    	tFundList = TFundParse.getTFundList(mContext);
    	for(TFund tFund: tFundList){
    		TFundNotify tFundNotify = new TFundNotify(0.1,true);
    		tFundNotify.setSeq(tFund.getSeq());
    		tFundNotify.setTfundCode(tFund.getTfundCode());
    		tFundNotify.setTfundName(tFund.getTfundName());
    		tFundNotifyList.add(tFundNotify);
    	}
    }
    
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.tfund_notify_list);
        mContext = getApplicationContext();
        sp = this.getSharedPreferences("GFundApp",MODE_PRIVATE);
        
        loadData();
        
        ActivityManage.add(this);
        adaptor = new TFundNotifyAdaptor(mContext, tFundNotifyList,sp); 
        setListAdapter(adaptor);
    }
}
